﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Collections.Generic;

namespace YXShop.Web.admin.member
{
    public partial class member_list_nostore : System.Web.UI.Page
    {   

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!this.Page.IsPostBack)
            {
                YXShop.Common.PromptInfo.Popedom("008001010");
                InitWebControl();
                GetList();
            }
        }

        private void InitWebControl()
        {
            ChangeHope.WebPage.WebControl.SetDropDownList(this.w_d_UserType, "code", "content", "yxs_code_usertype",true);
            ChangeHope.WebPage.WebControl.SetDropDownList(this.w_d_UserGroup, "id", "name", "yxs_memberrank",true);
        }
        private void GetList()
        {
            this.ltlview.Text = this.GetListInfo();
        }
        
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            GetList();
        }
        protected string GetListInfo()
        {
            YXShop.BLL.Member.MemberAccount bll = new YXShop.BLL.Member.MemberAccount();
            //获取所有为关联到门店的用户
            YXShop.Model.Admin.AdminInfo admin = YXShop.Common.AdministrorManager.Get();
            if (admin != null)
            {
                ChangeHope.DataBase.DataByPage datapage = bll.GetList(" and (storeid=0 or storeid is null)");
                ChangeHope.WebPage.DataTable table = new ChangeHope.WebPage.DataTable();
                table.DataReader = datapage.DataReader;
                table.RowHead = "选择/5%,会员名称/12%,会员等级/8%,资金余额/10%,点券/12%,有效期/13%,积分/12%,是否冻结/10%,操作/12%";
                table.RowText = "<input type=\"checkbox\" name=\"checkboxid\" value=\"{0}\">$UID,<a href='member_view.aspx?uid={1}'>{0}</a>$UserId|uid,UserGroupContent,￥{0}$Capital,{0}点点券$Coupons,PeriodOfValidity,{0}点积分$Points,<script>GetStat('{0}');</script>$state,<a href='member_nostore_edit.aspx?uid={0}'>关联到门店</a>$uid";
                string view = table.GetDataTable() + datapage.PageToolBar;
                datapage.Dispose();
                datapage = null;
                table = null;
                return view;
            }
            else
            {
                return "";
            }
        }
    }
}
